<HTML><HEAD><TITLE>membership_booleans(?Set, ?BoolArr)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">library(ic_hybrid_sets)</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>membership_booleans(?Set, ?BoolArr)</H1>
BoolArr is an array of booleans describing Set
<DL>
<DT><EM>Set</EM></DT>
<DD>a set, set variable, free variable or set expression
</DD>
<DT><EM>BoolArr</EM></DT>
<DD>A variable or an array (structure) of boolean variables
</DD>
</DL>
<H2>Description</H2>
<P>
    This constraint maintains the correspondence between a finite set and
    an array of booleans (0/1 variables). The set is constrained to contain
    those (and only those) integers I between 1 and N (the size of the array)
    where the corresponding array element is 1.
</P><P>
    Operationally, setting a array element I to 0 will exclude the element
    I from Set's domain. Setting I to 1 will include I in Set's lower bound.
    Adding and removing elements from Set will be reflected in the
    corresponding boolean being instantiated to 1 or 0 respectively.
</P><P>
    When called with BoolArr being a free variable, an array will be created
    whose arity is at least as big as the largest potential set member.
    Set members smaller than 1 will be excluded from the set.
    When called with BoolArr being instantiated to an array, set members
    smaller than 1 or bigger than the array size will be excluded from
    the set.
</P>
<H2>Examples</H2>
<PRE>
    ?- S::[2,4]..[1,2,3,4,5], membership_booleans(S,B).

    S = S{[2, 4] \/ ([] .. [1, 3, 5]) : _{[2 .. 5]}}
    B = [](_{[0, 1]}, 1, _{[0, 1]}, 1, _{[0, 1]})

    Delayed goals:
	...


    ?- membership_booleans(S, [](0,1,0,1,B5)).

    S = S{[2, 4] \/ ([] .. [5]) : _{[2, 3]}}
    B5 = B5{[0, 1]}

    Delayed goals:
	...
    </PRE>

</BODY></HTML>
